#!/bin/sh
# PX4 commands need the 'px4-' prefix in bash.
# (px4-alias.sh is expected to be in the PATH)
. px4-alias.sh

param load
param set CBRK_SUPPLY_CHK 894281

dataman start

tone_alarm start

ver all

param set IMU_GYRO_RATEMAX 1000

param set IMU_GYRO_FFT_EN 1
param set IMU_GYRO_FFT_MIN 10
param set IMU_GYRO_FFT_MAX 1000
param set IMU_GYRO_FFT_LEN 512
param set IMU_GYRO_FFT_SNR 10

# dynamic notches ESC/FFT/both
#param set IMU_GYRO_DNF_EN 1
#param set IMU_GYRO_DNF_EN 2
param set IMU_GYRO_DNF_EN 3

param set IMU_GYRO_DNF_BW 15
param set IMU_GYRO_DNF_HMC 3
param set IMU_GYRO_DNF_MIN 25

# test values
param set IMU_GYRO_CUTOFF 60
param set IMU_DGYRO_CUTOFF 40
#param set IMU_GYRO_NF0_FRQ 60
#param set IMU_GYRO_NF0_BW 5

# log nearly everything
param set SDLOG_PROFILE 859

fake_imu start

sensors start
gyro_fft start

logger start -f -t -b 10000 -p sensor_gyro
logger on

echo "Running for 10 seconds"
sleep 10

logger off

sensors status
listener sensor_gyro
listener sensor_gyro_fifo
listener sensor_gyro_fft
perf

echo "ALL TESTS PASSED"

shutdown
